﻿/* ============================================================================
(c) Copyright 2012 Hewlett-Packard Development Company, L.P.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge,publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
============================================================================ */
using System;
using System.Collections.Generic;
using HPCloud.Objects.Domain.Compute;
using HPCloud.Objects.Domain.Compute.Servers;
using HPCloud.Objects.Domain.Compute.Security;
using HPCloud.Objects.Domain.Compute.Networking;
using HPCloud.Objects.Domain.Compute.Servers.Actions;

namespace HPCloud.Objects.DataAccess
{
//=======================================================================================================================================================
/// <summary>
/// 
/// </summary>
//=======================================================================================================================================================
    public interface INetworkRepository
    {
        List<FloatingIP> GetFloatingIPs();
        FloatingIP GetFloatingIP(string floatingIPAddressId);
        void ReleaseFloatingIP(string floatingIPAddressId);
        FloatingIP RequestFloatingIP();
        void AssignIP(AssignIPAction assignment);
        void UnAssignIP(UnAssignIPAction assignment);
    }
//=======================================================================================================================================================
/// <summary>
/// 
/// </summary>
//=======================================================================================================================================================
    public interface IServerRepository
    {
        List<Server> GetServers(string name, Nullable<DateTime> changesSince, string imageId, string flavorId, ServerStatus status = ServerStatus.Unknown);
        List<Server> GetServers();
        Server SaveServer(NewServer server);
        Server GetServerByURI(string serverURI);
        Server GetServer(string serverId);
        void DeleteServer(string serverId);       
        MetaData SetMetadata(MetaData metadata, string serverId);
        void DeleteMetadata(string serverId, string key);       
        void UpdateServer(Server server);
        void Reboot(RebootAction action);
        void ChangePassword(ChangePasswordAction action);
        Log GetServerLog(GetServerLogAction action);

        //List<Address> GetAddresses(string serverId);
        //List<Address> GetAddresses(string serverId, string networkId);
        //void Rebuild(RebuildAction action);
        //void Resize(ResizeAction action);
        //void RevertResizeAction(RevertResizeAction action);
        //void ConfirmResize(ConfirmResizeAction action);
        //void CreateImage(CreateImageAction action);
    }
//=======================================================================================================================================================
/// <summary>
/// 
/// </summary>
//=======================================================================================================================================================
    public interface ISecurityRepository
    {
        List<SecurityGroup> GetSecurityGroups();
        SecurityGroup GetSecurityGroup(string securityGroupId);
        void DeleteSecurityGroup(string securityGroupId);
        SecurityGroup SaveSecurityGroup(NewSecurityGroup group);
        SecurityGroupRule SaveSecurityRule(NewSecurityRule rule);
        void DeleteSecurityRule(string securityGroupRuleId);
        List<KeyPair> GetKeyPairs();
        KeyPair SaveKeyPair(NewKeyPair keypair);
        void DeleteKeyPair(string keypairName);
        Limits GetLimits();
    }
//=======================================================================================================================================================
/// <summary>
/// 
/// </summary>
//=======================================================================================================================================================
    public interface IFlavorRepository
    {
        List<Flavor> GetFlavors();
        List<Flavor> GetFlavors(int? minimumDiskSpace, int? minimumRam);
        Flavor GetFlavorByURI(string flavorURI);
        Flavor GetFlavor(string flavorId);
    }
//=======================================================================================================================================================
/// <summary>
/// 
/// </summary>
//=======================================================================================================================================================
    public interface IImageRepository
    {
        List<Image> GetImages();
        List<Image> GetImages(string serveURI, string name, HPCloud.Objects.DataAccess.Compute.ImageRepository.ImageStatus? status, HPCloud.Objects.DataAccess.Compute.ImageRepository.ImageType? type, DateTime? changesSince);
        Image GetImageByURI(string imageURI);
        Image GetImage(string imageId);
        void SaveImage(NewImage image);
        void DeleteImage(string imageId);
    }
//=======================================================================================================================================================
/// <summary>
/// 
/// </summary>
//=======================================================================================================================================================
    public interface IMetaDataRepository
    {
        List<KeyValuePair<string, string>> GetMetaData();
        void SetMetaData (string serverId, List<KeyValuePair<string, string>> extendedProperties);
        void GetMetaDataItem(string serverId, string metaDataKey);
        void SetMetaDataItem(string serverId, string metaDataKey); 
    }
}
